home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / displst < prev    next >
Text File  |  1995-03-31  |  6KB  |  169 lines

  1. On first getting the Equation Library card for the HP48SX I was 
  2. naturally elated, but then a little disappointed to find that it 
  3. didn't have exactly the equations that I needed for my work. I 
  4. therefore set out to write them in by somehow emulating the Equation 
  5. library card. I found that the most difficult part for me was 
  6. implementing the scrolling/hilited menu system of the 48. The   
  7. program DISPLIST and associated routines do just that. DISPLIST 
  8. takes any list argument from the stack and displays it 6 elements at 
  9. a time, enabling you to scroll through it, highlighting the elements 
  10. one by one. If you press ENTER the program will exit, leaving the 
  11. number of the list element that is high-lighted on the stack. 
  12. Pressing QUIT (the 6th softkey) will exit the program, leaving zero 
  13. on the stack. The other 3 softkeys toggle between SI, ENG and no 
  14. units like the equation library card does.To change the title that 
  15. appears, change the text in the routine TITLE (32 chars max).
  16.  
  17. I'm sure there's a better way to do this in machine code, but this 
  18. will have to do for now. By using the HP supplied "USERLIB.EXE" 
  19. (available from HP's BBS or from the NOZONE-?) you can compile your 
  20. routines into a library, like the equation library, and use 
  21. "msolve",etc. Enjoy.
  22.  
  23. Jim Weisbin [693]
  24. 31 Langton Street
  25. London SW10 0JH
  26. 071-537-5320 (days) 
  27.  
  28. -----------------CUT HERE ----------------------------------------
  29. %%HP: T(3)A(D)F(.);
  30. DIR
  31.  DISPLIST
  32. \<< DUP SIZE DUP 6              @ a is the list                 @
  33. MIN 1 1 \-> a s t c d           @ s is the size                         @
  34.   \<< 64 CF TITLE a c           @ t is minimum of s or 6        @
  35. LISTOGR d HILITE                @ c is list counter             @
  36.     DO MNU1 TMENU               @ d is display counter  @
  37. -1 WAIT IP \-> x                @ mnu1 sets up soft menu        @
  38.       \<<                               @ start main loop               @
  39.         CASE { 33               @ left or up arrow scroll up @
  40. 25 } x POS
  41.           THEN d
  42. HILITE 'd' DECR 'c'             @ call HILITE routine           @
  43. DECR DROP2
  44.             CASE c
  45. 1 < d 1 < AND
  46.               THEN
  47. s DUP 'c' STO 1 + t
  48. - t 'd' STO s 6
  49. IF >
  50. THEN a SWAP LISTOGR             @ redisplay list (call LISTOGR) @
  51. ELSE DROP
  52. END
  53.               END c
  54. 1 < d 1 \>= AND
  55.               THEN
  56. s 'c' STO
  57.               END c
  58. 1 \>= d 1 < AND
  59.               THEN
  60. 1 'd' STO s 6
  61. IF >
  62. THEN a c LISTOGR                @ redisplay list (call LISTOGR)@
  63. END
  64.               END
  65.             END d 
  66. HILITE                          @ call HILITE routine             @
  67.           END { 35              @ right or dn arrow scroll dn  @
  68. 36 } x POS
  69.           THEN d
  70. HILITE 'c' INCR 'd'             @ call HILITE routine              @
  71. INCR DROP2
  72.             CASE c
  73. s > d t > AND
  74.               THEN
  75. 1 'c' STO 1 'd' STO
  76. s 6
  77. IF >
  78. THEN a c LISTOGR                @ redisplay list if s > 6       @
  79. END
  80.               END c
  81. s > d t \<= AND
  82.               THEN
  83. 1 'c' STO
  84.               END c
  85. s \<= d t > AND
  86.               THEN
  87. c 1 + t - t 'd' STO
  88. s 6
  89. IF >
  90. THEN a SWAP LISTOGR             @ redisplay list if s > 6       @
  91. ELSE DROP
  92. END
  93.               END
  94.             END d
  95. HILITE                          @ call HILITE routine           @
  96.           END x 11              @ 1st soft key (sets SI
  97. ==                                      @ units by setting flag 60)     @
  98.           THEN 60
  99. CF
  100.           END x 12              @ 2nd sost key (sets ENG        @               
  101. ==
  102.           THEN 60               @ units by clearing flag 60) @
  103. SF
  104.           END x 13              @ 3rd soft key sets units on/off @
  105. ==                                      @ (toggles flag 61)             @
  106.           THEN 61
  107. DUP
  108.             IF FS?
  109.             THEN CF
  110.             ELSE SF
  111.             END
  112.           END 16 x              @ 6th soft key quits and leaves @
  113. ==                                      @ zero on the stack             @
  114.           THEN 0
  115. DUP 'x' STO 2 MENU
  116.           END x 51              @ enter key quits and leaves @
  117. ==                                      @ number of list which is HILITEd @
  118.           THEN 0                @ on the stack for future use @
  119. 'x' STO c
  120.           END
  121.         END x
  122.       \>>
  123.     UNTIL 0 ==                  @ exit loop when zero on stack @
  124.     END
  125.   \>> 2 MENU                    @ user menu (VAR)               @
  126. \>>
  127.  HILITE
  128. \<< PICT
  129. GROB 131 9                              @ this is a solid black stripe @
  130.                                                 @ 9 pixels high @ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70
  131. ROT 1 - 8 * 7 + R\->B
  132. # 0d SWAP 2 \->LIST
  133. SWAP GXOR
  134. \>>
  135.  LISTOGR
  136. \<< 8 \-> a n c                         @ routine to get max 6 list @
  137.   \<< a n 1 a SIZE 6                    @ elements from starting @
  138. MIN                                             @ number n and convert them @
  139.     START GETI  \->STR 2                @ to a GROB @
  140. \->GROB # 131d # 9d                     @ a is the list                 @
  141. BLANK { # 0d # 0d }                     @ n is start number             @
  142. ROT GOR PICT SWAP                       @ c is counter (starts at 8) @
  143. # 2d c R\->B 'c' 8
  144. STO+ 2 \->LIST SWAP
  145. REPL
  146.     NEXT DROP2
  147.   \>>
  148. \>>
  149.  MNU1
  150. \<< 60
  151.   IF FC?                                @ routine to set up units menu @
  152.   THEN "SI " "ENG"               @ a la equation library card   @
  153.   ELSE "SI" "ENG "               @ use chr 258 for " "               @
  154.   END 61
  155.   IF FS?
  156.   THEN "UNITS"
  157.   ELSE "UNIT "
  158.   END " " " "
  159. "QUIT" 6 \->LIST
  160. \>>
  161.  TITLE
  162. \<< CLLCD LCD\-> { # 0d
  163. # 0d }                                  @ routine to title display @
  164. "YOUR TITLE HERE" 2                     @ insert your title here @
  165. \->GROB REPL PICT STO
  166. { # 0d # 0d } PVIEW
  167. \>>
  168. END
  169.